1
'************************** Module Header ******************************'
2 ' Module Name: UnsafeNativeMethods.vb
3 ' Project: VBSoftKeyboard
4 ' Copyright (c) Microsoft Corporation.
6 ' These methods are used to get/set the foreground window.
9 ' This source is subject to the Microsoft Public License.
10 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11 ' All other rights reserved.
13 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
14 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
15 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
16 '************************************************************************'
20 Imports System
.Runtime
.InteropServices
24 Friend NotInheritable Class UnsafeNativeMethods
27 ''' Retrieve a handle to the foreground window.
28 ''' http://msdn.microsoft.com/en-us/library/ms633505(VS.85).aspx
30 <DllImport("user32.dll", CharSet
:=CharSet
.Auto
, SetLastError
:=True)>
31 Public Shared
Function GetForegroundWindow() As IntPtr
35 ''' Bring the thread that created the specified window into the foreground
36 ''' and activates the window.
37 ''' http://msdn.microsoft.com/en-us/library/ms633539(VS.85).aspx
39 <DllImport("user32.dll", CharSet
:=CharSet
.Auto
, SetLastError
:=True)>
40 Public Shared
Function SetForegroundWindow(ByVal hWnd
As IntPtr
) As Boolean
44 ''' Determine whether the specified window handle identifies an existing window.
45 ''' http://msdn.microsoft.com/en-us/library/ms633528(VS.85).aspx
47 <DllImport("user32.dll", CharSet
:=CharSet
.Auto
, SetLastError
:=True)>
48 Public Shared
Function IsWindow(ByVal hWnd
As IntPtr
) As Boolean